﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ProductDetail.ascx.cs" Inherits="Components_ProductDetail" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<telerik:RadScriptManager ID="ScriptManager2" runat="server" EnableTheming="True"></telerik:RadScriptManager>

<asp:UpdatePanel ID="UpdatePanelDetail" runat="server">
<ContentTemplate>
<div class="leftCol" id="div_main" runat="server">
    <div class="detailInfo">
        <div class="detailInfoPic">
           <asp:Image ID="img" runat="server" BorderWidth="1" BorderStyle="Solid" BorderColor="#9a9488" CssClass="borderImg" Width="250px"  Height="300px"/>
        </div>
        <div class="detailInfoText">
            <div class="yellowTitle"><asp:HyperLink ID="lhProductTypeName" runat="server"></asp:HyperLink></div>
            <div class="clearBoth"></div>
            Tên gạo: <asp:Label ID="lblProductName" runat="server" Text=""></asp:Label><br />
            Đặc tính của gạo: <asp:Label ID="lblProductTypeName2" runat="server" Text=""></asp:Label><br />
            Giá bán: <b><asp:Label ID="lblPrice" runat="server" Text=""/>đ/kg</b><br />
            <!--Ưu đãi: Không<br />
            Tình trạng: <span class="greenText">Còn hàng</span><br /><br />-->
            Trọng lượng mua (kg)&nbsp;&nbsp;
            <asp:TextBox ID="txtWeight" runat="server" Width="50px" Text="1" onkeyup = "FormatNumber(this)"></asp:TextBox><br /><br />
            <asp:Button ID="btnOrder" class="greenBtn"  runat="server" Text="Đặt hàng"    OnCommand ="btnOrder_Command" CommandArgument='Click'/><%--&nbsp;&nbsp;Chia sẽ:&nbsp; 
            <a href="javascript://"><img src="~/Template/Images/img-1273251501-1.png" alt="FaceBook" title="FaceBook" id="PopUpFaceBook"  Width="23" Height="20" runat="server" /></a>
            <a href="javascript://"><img src="~/Template/Images/twitter2.jpg" alt="Twitter" id="PopUpTwitter" title="Twitter"  Width="21" Height="19" runat="server"/></a>--%>
            <br />
                        

        </div><!---detailInfoText------>
    </div><!---detailInfo--->
    <div class="clearBoth"></div>

    <div class="around">
        <div class="greenText22">Thông tin về gạo</div>
        <div class="greenLine"></div>
        <div class="yellowLine"></div>
        <p runat="server" id="p_content"></p>
        <div class="greenLine"></div>
        <div class="yellowLine"></div>
    </div><!--around--->

    <div class="around" id="div_Similar" runat="server"> 
    <div class="greenTitle"><a href="#">Sản phẩm cùng loại</a></div>
    <div class="four">
    
        <!-- ListView -->
    <asp:ListView ID="lvProductSimilar"  runat="server" >
        <LayoutTemplate>
           <div  id="div_listSimilar" runat="server"><asp:PlaceHolder ID="itemPlaceholder" runat="server" /></div>      
        </LayoutTemplate>
        <ItemTemplate>
            <div class="greenBg">
            <div class="info">
                <center>
                   <b> <%#Eval("ProductName")%></b><br />
                    <a href='<%#Utils.RemoveUnicode(Eval("Link").ToString())%>'>
                        <img src="<%# Utils.getUrlImage() +  Eval("ImagePath")%>" class="pic" alt='<%#Eval("ProductName")%>' />        
                    </a>
                    <br />
                    <b class="price"><%# String.Format("{0:N0}",Eval("Price"))%> vnđ/kg</b>
                    <asp:Button runat="server"  class="greenBtnSmall" ID="btnOrderSimilar" Text="Đặt hàng"
                        CommandArgument='<%#Eval("ProductID") + "@" + Eval("ProductName") + "@" +Eval("ProductCode")+"@"+ Eval("ImagePath") +"@"+ Eval("Price") + "@"+ Eval("IsPromotion")%>'  OnCommand="btnOrderSimilar_Command"/>
                    <!--<input type="btnOrder" class="greenBtn" value="đặt mua" /> -->
                </center>
            </div><!--info----->
            </div>
        </ItemTemplate>
    </asp:ListView>
    <!-- End ListView -->               
</div><!--four--->
</div><!--around--->
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="progressbar">
    <asp:UpdateProgress ID="up" runat="server" AssociatedUpdatePanelID="UpdatePanelDetail">
        <ProgressTemplate>
            <div class="bg">
                <div class="progress progress-striped active">
                    <div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0"
                        aria-valuemax="100" style="width: 100%">
                        <span class="sr-only">100% Complete</span>
                    </div>
                </div>
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
</div>
<script type="text/javascript">
    function OnClientClose(oWnd, args) {

    }
    function FormatNumber(obj) {

        var x;

        if (eval(obj))

            x = eval(obj).value;

        else

            x = obj;

        var num = x.replace(/$|,/g, '');

        if (isNaN(num)) { num = ""; }

        sign = (num == (num = Math.abs(num)));

        num = Math.floor(num * 100 + 0.50000000001);

        num = Math.floor(num / 100).toString();

        for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3) ; i++) {

            num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3));

        }

        eval(obj).value = num;

    }
    
</script>